package com.ecoolex.hotel.saas.enums;

import com.ecoolex.framework.common.EnumInterface;
import com.ecoolex.framework.common.util.Check;

public enum PresaleCouponStatus implements EnumInterface<PresaleCouponStatus, Integer> {
	EDITING(1, "编辑中"), 
	EDITED(2, "编辑完成"), 
	ONLINE(3, "上线"), 
	INVALID(4, "作废");

	private int real;

	private String describe;

	private PresaleCouponStatus(int real, String describe) {
		this.real = real;
		this.describe = describe;
	}

	@Override
	public Integer real() {
		return real;
	}

	@Override
	public String describe() {
		return describe;
	}

	@Override
	public PresaleCouponStatus realOf(Integer real) {
		if (Check.notNull(real)) {
			for (PresaleCouponStatus v : values()) {
				if (v.real().equals(real)) {
					return v;
				}
			}
		}
		return null;
	}
	
	public static Boolean canOnline(Integer status) {
		return EDITED.equal(status);
	}
	
	public static Boolean canOffline(Integer status) {
		return ONLINE.equal(status);
	}
	
	public static Boolean canDel(Integer status) {
		return EDITING.equal(status) || EDITED.equal(status);
	}
}
